local assets = {Asset("ANIM", "anim/alpha_rts_line.zip")}

local r,g,b = 52/255,1,214/255

local function fn()
    local inst = CreateEntity()
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()

    inst.AnimState:SetBank("alpha_rts_line")
    inst.AnimState:SetBuild("alpha_rts_line")
    inst.AnimState:PlayAnimation("idle", true)

    inst:AddTag("FX")
    inst:AddTag("NOCLICK")

    inst.AnimState:SetOrientation(ANIM_ORIENTATION.OnGround)
    inst.AnimState:SetLayer(LAYER_BACKGROUND)
    inst.AnimState:SetSortOrder(3) -- 1) --was 1 in forge
    -- local SCALE = 1.3
    -- inst.AnimState:SetScale(SCALE, SCALE,SCALE)
    inst.AnimState:SetMultColour(r,g,b, 1)
    inst.entity:SetPristine()

    if not TheWorld.ismastersim then return inst end

    inst.persists = false

    local i = 0
    inst:DoPeriodicTask(0.1,function ()
        i = i + 0.1
        local alpha = Lerp(1,0,i)
        if inst and inst.AnimState then
            inst.AnimState:SetMultColour(r,g,b,alpha)
        end
    end,2)

    inst:DoTaskInTime(4,inst.Remove)

    return inst
end

return Prefab('alpha_rts_line', fn, assets)
